﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="GrabPage.aspx.cs" Inherits="WebCrawler.GrabPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {

            $("#showtext").find('a').each(function () {

                var catid = $("#ContentPlaceHolder1_CATID").text().valueOf();

                var linktext = $(this).text();
                var linkhref = $(this).attr('href');

                var dataString = "link=" + linktext + "&url=" + linkhref + "&catid=" + Number(catid);
                //$("#URLS").append("<span style=color:blue>" + dataString + "</span>,");

                if (dataString) {

                    $.ajax({
                        type: "GET",
                        url: "GrabPage.aspx?" + dataString,
                        data: dataString,
                        cache: false,
                        success: function (html) {
                            $("#URLS").append("<span style=font-size:small>[" + linkhref + "]</span>,");
                        }

                    });
                }


            });

        });
    </script> 

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">  
<asp:Label ID="NewPage" runat="server" Visible="false" />
<asp:Label ID="CATID" runat="server" Visible="true" />
<p id="URLS"></p>
 <div id="showtext" style="display:block">
    <% Response.Write(NewPage.Text); %>
</div>
<asp:Timer ID="timer_Page" runat="server" Interval="300000" OnTick="GetNextPage">
</asp:Timer>
</asp:Content>